
public class Test19092303 {
	public static void main (String[]args) {
include <iostream>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int bai = n b0M
			/ 100;
	int shi = n /10 % 10;
	int ge = n% 10;
	int num bai * 100000 + shi * 10000 +ge * 1000 + n;
	cout << num/7/11/13<< endl;
	return 0;
}